package com.nvwa.coding.model;

public class Tuple<T> implements ValueValidator {

    public final T value;

    public Tuple(T value) {
        this.value = value;
    }

    public T get() {
        return value;
    }

    public Opt<T> opt() {
        return Opt.of(value);
    }

    public boolean isEmpty() {
        return value == null;
    }

    public <T2> Tuple2<T, T2> with(T2 _2) {
        return new Tuple2<>(value, _2);
    }

    @Override
    public boolean valid() {
        return value != null;
    }

}
